package Controllers;

import DB.DBEmployee;
import Models.Employee;
import java.util.ArrayList;

public class EmployeeController implements ControllerInterface<Employee>
{ 
	public EmployeeController ()
	{}

	public int insert(Employee employee)
	{
		DBEmployee dbe = new DBEmployee();
		return dbe.insert(employee.exportData());
	}

	public void insertDependent(ArrayList<? extends DB.RowInterface> data)
	{}

	public Employee find(int id)
	{
		DBEmployee dbe = new DBEmployee();
		return dbe.fetchByNo(id);
	}

	public int update(Employee employee, String where)
	{
		DBEmployee dbe = new DBEmployee();
		return dbe.update(employee.exportData(), where);
	}

	public void updateDependent(ArrayList<? extends DB.RowInterface> data, String where)
	{}

	public int delete(int id)
	{
		DBEmployee dbe = new DBEmployee();
		return dbe.deleteByNo(id);
	}

	public ArrayList<Employee> fetchAll()
	{
		DBEmployee dbe = new DBEmployee();
		return dbe.fetchAll();
	}
}